﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;


/**
* @Author: AdinZ
* @Q  Q : 1454269
* @Email:adinz@adinz.com
* @Created: 2014/5/22 23:03:34
*
* */
namespace Novel.Sys.Dal
{
    public class novel_ads
    {

        public Model.novel_ads GetModel(int Type)
        {
            Model.novel_ads model = new Model.novel_ads();
            string sql = "SELECT TOP 1 * FROM novel_ads ORDER BY NewID()";
            DataSet ds = AdinZ.DB.DbHelpers.GetDataSet(sql);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["ID"] != null && ds.Tables[0].Rows[0]["ID"].ToString() != "")
                {
                    model.ID = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["name"] != null && ds.Tables[0].Rows[0]["name"].ToString() != "")
                {
                    model.Name = ds.Tables[0].Rows[0]["name"].ToString();
                }
                if (ds.Tables[0].Rows[0]["code"] != null && ds.Tables[0].Rows[0]["code"].ToString() != "")
                {
                    model.Code = ds.Tables[0].Rows[0]["code"].ToString();
                }
                if (ds.Tables[0].Rows[0]["sign"] != null && ds.Tables[0].Rows[0]["sign"].ToString() != "")
                {
                    model.Sign = ds.Tables[0].Rows[0]["sign"].ToString();
                }
                if (ds.Tables[0].Rows[0]["type"] != null && ds.Tables[0].Rows[0]["type"].ToString() != "")
                {
                    model.Type = int.Parse(ds.Tables[0].Rows[0]["type"].ToString());
                }
                if (ds.Tables[0].Rows[0]["content"] != null && ds.Tables[0].Rows[0]["content"].ToString() != "")
                {
                    model.Content = ds.Tables[0].Rows[0]["content"].ToString();
                }
            }
            return model;
        }


    }
}
